from django.db import models


# Create your models here.

class CarInfo(models.Model):
    id = models.AutoField('id', primary_key=True)
    brand_name = models.CharField(max_length=100, default='', verbose_name='品牌名')
    car_name = models.CharField(max_length=100, null=True, blank=True, unique=True, db_index=True,
                                verbose_name='汽车名')
    car_img = models.CharField(max_length=200, default='', verbose_name='汽车图片链接')
    count = models.CharField(max_length=100, default='', verbose_name='销量')
    price = models.CharField(max_length=100, default='', verbose_name='价格')
    manufacturer = models.CharField(max_length=100, default='', verbose_name='厂商')
    rank = models.CharField(max_length=50, default='', verbose_name='销量排名')
    model = models.CharField(max_length=50, default='', verbose_name='级别')
    energyType = models.CharField(max_length=50, default='', verbose_name='能源类型')
    marketTime = models.CharField(max_length=50, default='', verbose_name='上市时间')
    warrantyPeriod = models.CharField(max_length=50, default='', verbose_name='保修期')

    class Meta:
        db_table = 'carinfo'  # 表名
        verbose_name = verbose_name_plural = '汽车信息'  # 后台管理显示名称

    def __str__(self):
        return self.car_name
